cmake_minimum_required(VERSION 3.0.0)

set(PEOJECT_NAME "StepperMotorRun")

project(${PEOJECT_NAME}  VERSION 0.1.0 LANGUAGES C)
SET(CMAKE_BUILD_TYPE "Debug") 
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -std=c99")
SET(CMAKE_C_FLAGS_DEBUG "$ENV{CFLAGS} -Og -Wall -g -ggdb")
SET(CMAKE_C_FLAGS_RELEASE "$ENV{CFLAGS} -Og -Wall")

add_definitions(-D DEBUG_PRINT -D HARDWARE_DISABLE)
add_compile_options(-Wall)
# include(CTest)
# enable_testing()

# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
# SET(CMAKE_BUILD_TYPE "Debug")
# SET(CMAKE_C_FLAGS_DEBUG "$ENV{CCFLAGS} -O0 -Wall -g2 -ggdb")
# SET(CMAKE_C_FLAGS_RELEASE "$ENV{CCFLAGS} -O3 -Wall")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")

# set(CMAKE_CXX_FLAGS   "${CMAKE_CXX_FLAGS} -g")                     # ������Ϣ
# set(CMAKE_CXX_FLAGS_DEBUG   "${CMAKE_CXX_FLAGS_DEBUG} -O0" )             # ���԰����Ż�
# set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -DNDEBUG " )   # release���Ż�

aux_source_directory(./ SOURCE0)
# aux_source_directory(../Library SOURCE2)

aux_source_directory(Application SOURCE30)
aux_source_directory(Application/CommunicationInterface SOURCE31)
aux_source_directory(Application/Controller SOURCE32)
aux_source_directory(Application/Logger SOURCE33)
aux_source_directory(Application/Protection SOURCE34)
aux_source_directory(Application/Trajectory SOURCE35)
aux_source_directory(Application/Algorithm SOURCE36)
aux_source_directory(Application/StepController SOURCE37)

aux_source_directory(Common SOURCE40)

aux_source_directory(ConfigOption/Application SOURCE50)
aux_source_directory(ConfigOption/Driver SOURCE51)

aux_source_directory(Driver SOURCE60)
aux_source_directory(Driver/DriverBoard SOURCE61)
aux_source_directory(Driver/Encoder SOURCE62)
aux_source_directory(Driver/Mcu SOURCE63)
aux_source_directory(Driver/StepperMotor SOURCE64)

# add_definitions(-D BOARD=2)


message("==========================")
# message(${CMAKE_C_FLAGS})
message("--------------------------")

add_executable(${PEOJECT_NAME} 
${SOURCE0}

${SOURCE30}
${SOURCE31}
${SOURCE32}
${SOURCE33}
${SOURCE34}
${SOURCE35}
${SOURCE36}
${SOURCE37}

${SOURCE40}

${SOURCE50}
${SOURCE51}

${SOURCE60}
${SOURCE61}
${SOURCE62}
${SOURCE63}
${SOURCE64}
)

# set(CPACK_PROJECT_NAME ${PROJECT_NAME})
# set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
# include(CPack)

include_directories(./
# ../Library/STC32G
# ../Library/ch32v30x/Core
# ../Library/ch32v30x/Peripheral/inc
Application
Application/CmdLine
Application/CommunicationInterface
Application/Controller
Application/Logger
Application/Protection
Application/Trajectory
Application/Algorithm
Application/StepController
Driver
Driver/DriverBoard
Driver/Encoder
Driver/Mcu
Driver/StepperMotor
ConfigOption/
ConfigOption/Application
ConfigOption/Driver
Common

)


